import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;


public class StartFrame extends JFrame
{

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args)
	{
        int [] hand = {40,22,48,47};
        System.out.println("Cards:");
        for(int i = 0; i < hand.length; i++){
            System.out.println(Card.getString(hand[i] / 13, hand[i] % 13));
        }
        System.out.println("************************************");
        int [] result = Hand.getReducedHand(hand);
        for(int i = 0; i < result.length; i++) {
            System.out.println(Card.getString(result[i]/13, result[i]%13));
        }

		EventQueue.invokeLater(new Runnable() {
			public void run()
			{
				try
				{
					StartFrame frame = new StartFrame();
					frame.setVisible(true);
				} catch (Exception e)
				{
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public StartFrame()
	{
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 300, 174);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JButton btnJoinPlay = new JButton("Dołącz do gry");
		btnJoinPlay.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				PlayFrame NewFrame = new PlayFrame("joinPlay");
				NewFrame.setVisible(true);
				dispose();
			}
		});
		btnJoinPlay.setBounds(35, 11, 213, 38);
		contentPane.add(btnJoinPlay);
		
		JButton btnCreatePlay = new JButton("Utwórz nową grę");
		btnCreatePlay.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				PlayFrame NewFrame = new PlayFrame("newPlay");
				NewFrame.setVisible(true);
				dispose();
			}
		});
		btnCreatePlay.setBounds(35, 68, 213, 38);
		contentPane.add(btnCreatePlay);
	}
}
